import request from '@/utils/request';
import type { AxiosResponse } from 'axios';
import type { catalogueThink,createBidParams } from '@/api/bid/bidtypes';
export const createBid = (data: createBidParams): AxiosResponse<any> => {
  return request({
    url: '/document/gen_bid',
    method: 'post',
    data: data
  });
};

export const chapterThink = (data: catalogueThink): AxiosResponse<any> => {
  return request({
    url: '/document/gettitle',
    method: 'post',
    data: data
  });
};

export const getChapterThinkResult = (bid: string): AxiosResponse<any> => {
  return request({
    url: '/document/get_title_result/' + bid,
    method: 'get',
  });
};

export const detailedTitles = (data: any): AxiosResponse<any> => {
  return request({
    url: '/document/detailed',
    method: 'post',
    data: data
  });
};


export const getDetailedTitles = (bid: string): AxiosResponse<any> => {
  return request({
    url: '/document/get_detailed/' + bid,
    method: 'get',
  });
};

export const getCatalogByBid = (data: any): AxiosResponse<any> => {
  return request({
    url: '/document/getCatalogByBid',
    method: 'post',
    data: data
  });
};
export const getChildernBidserial = (data: any): AxiosResponse<any> => {
  const { signal, ...requestData } = data;
  return request({
    url: '/document/getbid',
    method: 'post',
    data: requestData,
    signal: signal
  });
};
export const getChildrenBidPathId = (data: any): AxiosResponse<any> => {
  return request({
    url: '/document/getChildrenBid_path_id',
    method: 'post',
    data: data
  });
};
export const getfull = (data: any): AxiosResponse<any> => {
  return request({
    url: '/document/gencontent',
    method: 'post',
    data: data
  });
};
/* export const createbid = (data: any): AxiosResponse<any> => {
  return request({
    url: '/document/createbid',
    method: 'post',
    data: data
  });
}; */
export const getBidList = (data: any): AxiosResponse<any> => {
  return request({
    url: '/document/list',
    method: 'post',
    data: data
  });
};
export const downDocByBid = (data: any): AxiosResponse<any> => {
  return request({
    url: '/document/downDocByBid',
    method: 'post',
    data: data,
    responseType: 'blob' // 重要：设置响应类型为 blob
  });
};
export const bid_upload= (data: FormData): AxiosResponse<any> => {
  return request({
    url: '/document/bid_upload',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};
export const parseBidFile = (data: any): AxiosResponse<any> => {
  return request({
    url: '/document/parse_bid_file',
    method: 'post',
    data: data
  });
}